#pragma once

template <class iterator, class Ref, class ptr>
class ReverseIterator
{
	typedef ReverseIterator<iterator, Ref, ptr> self;
public:
	ReverseIterator(iterator it)
		:_it(it)
	{}

	Ref operator*()
	{
		return *_it;
	}
	
	ptr operator->()
	{
		return _it.operator->();
	}
	
	self& operator++()
	{
		--_it;
		return *this;
	}

	bool operator!=(const self& s)
	{
		return _it != s._it;
	}
private:
	iterator _it;
};